#ifndef NANE_FUNCTIONBASE_H
#   define NANE_FUNCTIONBASE_H

#   include "nane/core/function/ForwardParamT.h"

namespace nane
{
    template<class Caller>
    class Functor
    {
    public:
        typedef typename Caller::TReturn TReturn;
        typedef typename Caller::TParam1 TParam1;
        typedef typename Caller::TParam2 TParam2;
        typedef typename Caller::TParam3 TParam3;
        typedef typename Caller::TParam4 TParam4;

        Functor( Caller _caller )
            : m_caller( _caller )
        {

        }

        TReturn operator()()
        {
            return m_caller.Call();
        }

        TReturn operator()( typename ForwardParamT<TParam1>::Type _a1 )
        {
            return m_caller.Call(_a1);
        }

        TReturn operator()( typename ForwardParamT<TParam1>::Type _a1
                          , typename ForwardParamT<TParam2>::Type _a2 )
        {
            return m_caller.Call(_a1, _a2);
        }

        TReturn operator()( typename ForwardParamT<TParam1>::Type _a1
                          , typename ForwardParamT<TParam2>::Type _a2
                          , typename ForwardParamT<TParam3>::Type _a3 )
        {
            return m_caller.Call(_a1, _a2, _a3);
        }

        TReturn operator()( typename ForwardParamT<TParam1>::Type _a1
                          , typename ForwardParamT<TParam2>::Type _a2
                          , typename ForwardParamT<TParam3>::Type _a3
                          , typename ForwardParamT<TParam4>::Type _a4 )
        {
            return m_caller.Call(_a1, _a2, _a3, _a4);
        }

    private:
        Caller m_caller;
    };

}   // namespace nane

#endif	// NANE_FUNCTIONBASE_H
